import { Post, Delete, Get, Put } from "@/api/request";

export const getMenu = () => {
    return Post('api/v1/system/getMenu', {})
}

export const ApiMachList = (page, rows) => {
    return Post("/api/v1/mach/list", {
        page: page,
        rows: rows
    });
}

export const ApiMachDelete = (id) => {
    return Delete("/api/v1/mach/delete?key=" + id, null)
}

export const ApiMachGetDetail = (id) => {
    return Get("/api/v1/mach/getDetail?key=" + id, {})
}

export const ApiMachUpdateStatus = (syncTableId, status) => {
    return Put("/api/v1/mach/updateStatus?key=" + syncTableId + "&status=" + status, {})
}

export const ApiMachGetSourceTable = () => {
    return Get("/api/v1/mach/getSourceTable", {})
}

export const ApiMachGetTargetTable = () => {
    return Get("/api/v1/mach/getTargetTable", {})
}

export const ApiMachSaveSyncConfig = (obj) => {
    return Post("/api/v1/mach/saveSyncConfig", obj)
}

export const ApiMachGetTargetField = (tableName) => {
    return Get("/api/v1/mach/getTargetField?tableName=" + tableName, {})
}

export const ApiMachGetSourceField = (tableName) => {
    return Get("/api/v1/mach/getSourceField?tableName=" + tableName, {})
}

export const getTaskTableList = (key, current, pageSize) => {
    return Post("/Schedule/getTaskTableList", {
        key: key,
        page: current,
        rows: pageSize,
    });
}

export const getTaskList = (current, pageSize) => {
    return Post("/Schedule/getTaskList", {
        page: current,
        rows: pageSize,
    });
}

export default {
    getMenu,
    getTaskTableList,
    getTaskList,
    ApiMachList,
    ApiMachDelete,
    ApiMachGetDetail,
    ApiMachUpdateStatus,
    ApiMachGetSourceTable,
    ApiMachGetTargetTable,
    ApiMachSaveSyncConfig,
    ApiMachGetTargetField,
    ApiMachGetSourceField,
}